]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Improve allocation of workspace controls
authorOwen W. Taylor <otaylor@fishsoup.net>
Wed, 9 Feb 2011 23:54:46 +0000 (18:54 -0500)
committerOwen W. Taylor <otaylor@fishsoup.net>
Thu, 17 Feb 2011 16:34:30 +0000 (11:34 -0500)
Fix a bug in the computation of the zoomed-out scale and use a StBin
instead of an unnecessary StBoxLayout. Using the StBin will allow
correct width-for-height behavior for the controls.

https://bugzilla.gnome.org/show_bug.cgi?id=641879

js/ui/workspacesView.js

index 55f198726f6adec1843095756a4d66c5d0ba74c1..691ef67a409abb7aa16b6da2872ae7eebc8741f9 100644 (file)
@@ -594,8 +594,9 @@ WorkspacesDisplay.prototype = {
         this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
         this.actor.connect('allocate', Lang.bind(this, this._allocate));
 
-        let controls = new St.BoxLayout({ vertical: true,
-                                          style_class: 'workspace-controls' });
+        let controls = new St.Bin({ style_class: 'workspace-controls',
+                                    request_mode: Clutter.RequestMode.WIDTH_FOR_HEIGHT,
+                                    y_align: St.Align.START });
         this._controls = controls;
         this.actor.add_actor(controls);
 
@@ -605,7 +606,7 @@ WorkspacesDisplay.prototype = {
                          Lang.bind(this, this._onControlsHoverChanged));
 
         this._thumbnailsBox = new WorkspaceThumbnail.ThumbnailsBox();
-        controls.add(this._thumbnailsBox.actor, { expand: false });
+        controls.add_actor(this._thumbnailsBox.actor);
 
         this.workspacesView = null;
 
@@ -638,7 +639,7 @@ WorkspacesDisplay.prototype = {
         let totalWidth = totalAllocation.x2 - totalAllocation.x1;
         let totalHeight = totalAllocation.y2 - totalAllocation.y1;
 
-        let [controlsMin, controlsNatural] = this._controls.get_preferred_width(-1);
+        let [controlsMin, controlsNatural] = this._controls.get_preferred_width(totalHeight);
         let controlsReserved = controlsNatural * (1 - CONTROLS_POP_IN_FRACTION);
 
         totalWidth -= controlsReserved;
@@ -664,7 +665,7 @@ WorkspacesDisplay.prototype = {
         if (rtl)
             x += controlsReserved;
 
-        let zoomScale = (totalWidth - controlsNatural) / totalWidth;
+        let zoomScale = (totalWidth - (controlsNatural - controlsReserved)) / totalWidth;
         let newView = new WorkspacesView(width, height, x, y, zoomScale, this._workspaces);
 
         if (this.workspacesView)